package Logic;

public class Rank {
	
	private Movie movie;
	private User user;
	private int rank;
	private final static String[] fields = {"movie","user","rank"};
	
	public Rank(Movie mov, User usr, int rnk){					
		movie = mov;
		user = usr;
		rank = rnk;
	}
	
	public double getRelativeRank(){
		return (rank - user.getAverageRank());
	}
	
	public Movie getMovie(){
		return movie;
	}
	
	public User getUser(){
		return user;
	}
	
	public int getRank(){
		return rank;
	}
	
	public void setRank(int rank){
		this.rank = rank;
	}
	
	public String toString(){
		return user.getUsername() + " ranked " + movie.getName() + " : " + rank;
	}
	
	public String[] getFields(){
		return fields;
	}
	
	public String[] getVals(){
		String[] vals = new String[3];
		vals[0] = movie.getName();
		vals[1] = user.getUsername();
		vals[2] = "" + rank;
		return vals;
	}

}
